#include "user.h"

User::User() {
    this->generateIdentify();
}

User::User(QString login) {
    this->generateIdentify();
    this->login = login;
}

User::User(QString login, QString passHash) {
    this->generateIdentify();
    this->login = login;
    this->passHash = passHash;
}

void User::generateIdentify() {
    QString randomString = QString::number( QDateTime::currentMSecsSinceEpoch() ).append( QString::number( rand() ));
    QByteArray hash = QCryptographicHash::hash(randomString.toAscii(), QCryptographicHash::Md5).toHex();
    this->identify = hash;
}

QString User::getIdentify() {
    return this->identify;
}

QString User::getLogin() {
    return this->login;
}

QString User::getPassHash() {
    return this->passHash;
}
